package cn.lili.modules.search.entity;

import cn.lili.elasticsearch.EsSuffix;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.List;

/**
 * 问题ES索引
 *
 * @author LiLang
 * @since 2022/09/22
 */
@Data
@Accessors(chain = true)
@Document(indexName = "#{@elasticsearchProperties.indexPrefix}_" + EsSuffix.QANDA_INDEX_NAME)
public class EsQuestionIndex implements Serializable {

    @Id
    private Integer id;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    private String title;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    private String content;

    //    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    @Field(type = FieldType.Text)
    private String createUserName;

    @Field(type = FieldType.Text)
    private String createUserHead;

    //    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    @Field(type = FieldType.Text)
    private String industryName;

    @Field(type = FieldType.Text)
    private String industryIcon;

    @Field(type = FieldType.Boolean)
    private Boolean isRenzheng;
//
//    @Field(type = FieldType.Long)
//    private Long userId;

    @Field(type = FieldType.Nested)
    private List<EsQuestionDetail> details;

}